home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS 1995 January / Simtel - 10000 MSDOS Shareware Programs (Walnut Creek)(January 1995)(Disc 2).ISO / disc2 / ncsatlnt / dev_note.txt < prev    next >
Text File  |  1994-11-15  |  47KB  |  1,166 lines

  1.  
  2.  
  3. NCSA Telnet
  4. Developers Guide
  5.  
  6. This is an ASCII-printable version of the developers' documentation.
  7.  
  8.  
  9. Version 2.3 release
  10. National Center for Supercomputing Applications
  11. The code and documentation are in the public domain.
  12.  
  13.  
  14. Compiler Notes
  15.  
  16. This version was compiled with Microsoft C version 7.0.  The Macro Assembler
  17. code was assembled using MASM 5.1, although it also assembles with MASM 6.0.
  18.  
  19.  
  20. ----------------------
  21. TCP Kernel Calls
  22.  
  23. Tim Krauskopf                        July 11, 1988
  24.  
  25. netsetip(ipnum)
  26. char ipnum[4];        IP address to use.
  27. Set my IP address.  This routine must be called before 
  28. calling netinit, in order for netinit to know what return 
  29. address to use during initialization.  Usually called by a 
  30. session layer routine.
  31.  
  32. netconfig(hw)
  33. char *hw;        Hardware type - string of <10 chars.
  34. This call tells the kernel what type of hardware to use, 
  35. "AppleTalk" or "Ether" on the Mac, for example.  When 
  36. multiple hardware types are supported, the lower layer must 
  37. be informed of which type to use.  Called by Snetinit() 
  38. after the value is read from the configuration file.
  39.  
  40. netparms(irq,address,ioaddr)
  41. int irq;          Hardware parameter,  irq is the interrupt request level
  42. int address;      Shared memory segment address to use for starting
  43.                   Ethernet driver
  44. int ioaddr;       Hardware I/O address parameter
  45.    Set hardware dependent network configuration.  The address
  46. and I/O address parameters only apply if the hardware needs 
  47. them.  These values are filled in by the Session layer in 
  48. most cases.
  49.  
  50. neteventinit()
  51. Initializes network event queue so that errors and 
  52. connection information can be posted.  VERY IMPORTANT.  
  53. Called by Snetinit().
  54.  
  55. netarptime(secs)
  56. int secs;         Amount of time in seconds to try to find local hosts or
  57.                   local gateways.
  58. A particularly slow machine may take five seconds to respond 
  59. to an ARP request.  Most return an answer within 1/2 second.   
  60. This timeout produces the "local host not responding" error.
  61.  
  62. netsetmask(mask)
  63. char mask[4];        Subnet mask to use for future gateway calculations
  64. Set the subnetting mask.  If this is not called before 
  65. netinit(),  netinit() will install the default addressing 
  66. mask for the class A,B or C network according to the address 
  67. in netsetip.
  68.  
  69. netgetmask(mask)
  70. char mask[4];        location to put the copy of the subnet mask
  71. Copies the subnetting mask.  Not very useful if called 
  72. before the network initialization.  Session layer routines 
  73. are typically used to set the value before you try to call 
  74. netgetmask().
  75.  
  76. netgetip(ipnum)
  77. char ipnum[4];        Location to place IP address
  78. Get my IP address.  Used when one session layer routine sets 
  79. the IP address but another one needs to know the value.  Any 
  80. time after netsetip, netgetip can obtain a copy of the 
  81. address.
  82.  
  83. char *neterrstring(errno)
  84. int errno;        error number of look up
  85. Get a pointer to the error string associated with "errno".  
  86. Your custom error handler can use this to look up a "canned" 
  87. error message.  Copy the message, print it, whatever.  Don't 
  88. worry if the errno is -1, that is a special case that works 
  89. OK.  Neterrstring will always return a valid string.
  90.  
  91. netinit()
  92. Sets up the hardware and initializes vars.  Must be called 
  93. before netopen.  Use of Snetinit() is recommended instead of 
  94. netinit().  It calls Sreadhosts(), netinit() and Ssetgates() 
  95. for you.
  96.  
  97. netsetgate(ipnum)
  98. char ipnum[4];        IP address of gateway
  99. Install this IP number as a gateway.  Does an ARP request 
  100. immediately, because we assume we will need its Ethernet 
  101. address.
  102.  
  103. dl = netdlayer(ipnum)
  104. char *dl;        48-bit Ethernet address or psuedo-address from ARP cache
  105. char  ipnum[4];        IP number to look up with ARP.
  106. Queries the network with a broadcast ARP request every 
  107. second and returns the Ethernet address for the requested IP 
  108. address.  Returns NULL on failure.  Blocks for arptime 
  109. seconds or until the response arrives.  One of the very few 
  110. blocking calls, only done this way because it is easier and 
  111. ARP is so quick.
  112.  
  113. netgetrarp()
  114. Pulls the local Ethernet address stored during the netinit() 
  115. and sends a RARP packet every second.  Waits for the 
  116. response and returns 0 for success or negative for failure.  
  117. If a valid response comes in, then netgetip() will return 
  118. the new IP number.  Unfortunately, to get everything to 
  119. work, the combination netgetip(); netsetip() must be 
  120. executed to set all of the internal variables.
  121.  
  122. netsegsize(size)
  123. int size;        new segment size to use for future connection attempts
  124. Set the maximum segment size (for incoming packets).  This 
  125. value will take affect on all future opening connections, 
  126. whether from netopen() or netlisten().  Can be changed any 
  127. time, but cannot affect current connections, only future 
  128. ones.  Netlisten takes this value when called, not when the 
  129. connection eventually opens.
  130.  
  131. netquench(limit)
  132. int limit;        largest TCP window that can be advertised.  
  133. Set the maximum window (for incoming packets) that future 
  134. connections should allow.   Will have no effect when set to 
  135. a value over the program's maximum.
  136.  
  137. netfromport(port)
  138. int port;        TCP protocol number to use for next netopen request.
  139. When netopen starts a connection, the destination port 
  140. number is requested by the application, i.e. 23 for the 
  141. well-known telnet port.  The return (local) port number is 
  142. usually randomly generated to be unique from all local ports 
  143. in use.  If the application needs a specific local port 
  144. number (as the default port for FTP data transfers 
  145. requires), this call can force a particular number.  The 
  146. setting goes away after the next netopen call.
  147.  
  148. pn = netopen(ipnum,service)
  149. char ipnum[4];        Address of machine to connect to, in binary
  150. int service;        TCP port to attempt to connect to, often the WKA for a 
  151. service
  152. int pn;            port number for use in later calls to just about every 
  153. routine available
  154. Open a connection to another machine (up to 30 times).  
  155. Returns a file descriptor to use in later calls.  Netopen is 
  156. often used only in a session layer routine which does name 
  157. to IP address translation before calling netopen.  See 
  158. Snetopen() for open which includes name translation.
  159.  
  160. cnt = netread(pn,buf,len)
  161. int pn;            port number from netopen()
  162. char *buf;        pointer to data space to read into
  163. int len;            maximum length of data to read
  164. int cnt;            returns # of bytes read, -1 on closed connection, 0 
  165. for waiting
  166. Similar to UNIX read, but using a file descriptor from 
  167. netopen().  Does not block EVER.
  168.  
  169. cnt = netwrite(pn,buf,len)
  170. int pn;            port number from netopen()
  171. char *buf;        pointer to data space to write from
  172. int len;            length of data to try to write
  173. int cnt;            returns # of bytes written, -1 on closed connection, 0 
  174. for waiting
  175.  
  176. Similar to UNIX write, but using a file descriptor from 
  177. netopen().  Does not block EVER.
  178.  
  179. netclose(pn)    
  180. int pn;            port number from netopen()
  181. Close a connection, like closing a file.  You must make sure 
  182. (with netpush()) that all data which went through netwrite() 
  183. to this file descriptor has been sent before closing.  
  184. Before closing, you will also want to read all of the 
  185. available data from the connection if you don't want to lose 
  186. it.
  187.  
  188. netshut()
  189. Shut down communication, disable interrupts.  It is not wise 
  190. to call any network routines at all after calling netshut().
  191.  
  192. netsleep(secs)
  193. int secs;        number of seconds to wait before returning
  194. This is what keeps the network drivers alive.  It makes sure 
  195. that any required ACKs are sent.  Often called with a 
  196. parameter of zero, but can be made to wait some # of secs.  
  197. Has a resolution of 1/18th of a second on PC, 1/60th on Mac.
  198.  
  199. netest(pn)
  200. int pn;            port number from netopen()
  201. Returns 0 if the connection is in established mode, <0 if 
  202. one side or the other has closed the connection.
  203.  
  204. cnt = netpush(pn)
  205. int pn;            port number from netopen()
  206. int cnt;            number of bytes still waiting to be delivered 
  207. (outgoing)
  208. Sets push bit on transmit, returns size of output queue 
  209. (unacknowledged data).  Check to see that this value is zero 
  210. before calling netclose().  Unless you don't care.
  211.  
  212. netqlen(pn)
  213. int pn;            portnumber from netopen()
  214. Returns the number of bytes waiting to be read (incoming) 
  215. which have been acked, but have not been taken from the 
  216. queue.
  217.  
  218. netroom(pn)
  219. int pn;            port number from netopen()
  220. Get information on buffer space from a port.  netroom 
  221. returns the number of bytes available for a netwrite() 
  222. command to write into.  If the TCP is caught up, this will 
  223. be WINDOWSIZE, if we are loaded, this could be zero.
  224.  
  225. netgetftp(a,pn)
  226. int a[8];        return values
  227. int pn;            port number from netopen()
  228. Get information about an active connection.  Returns the IP 
  229. address of the other machine which is connected to you and 
  230. the incoming and outgoing  TCP port numbers in use.  a[0] to 
  231. a[3] is the IP number of the other host.  Note that these 
  232. are integers, not characters!  a[4]  and a[5] are the high 
  233. and low bytes (yet stored in integers) of your local port 
  234. number.  a[6] and a[7] are the high and low bytes of the 
  235. other side's port number for this connection. 
  236.  
  237. pn = netlisten(service)
  238. int service;        TCP port number to listen to.
  239. int pn;            Returns a port number equivalent to a netopen() port 
  240. number
  241. Listen to a TCP port number.  The TCP will establish the 
  242. connection for you automatically.   You will be notified 
  243. with an event when the connection occurs.  Try not to get 
  244. the TCP port number confused with the netopen() port number.  
  245. The TCP port number defines the network connection between 
  246. machines while the netopen() port number is a local 
  247. descriptor for a given connection.
  248.  
  249. netusend(ipnum,port,retport,buf,len)
  250. char *ipnum[4];    IP number of other machine
  251. int port,retport;        to and from ports for the other machine's UDP socket
  252. char *buf;        data to be sent in the packet
  253. int len;            number of bytes of data to send, must fit in 512 byte 
  254. packet
  255. Send a UDP packet to another machine, to a certain port, 
  256. with the data in buf, length n.
  257.  
  258. netulisten(port)
  259. int port;        port to be sensitive about
  260. Listen for a UDP packet on a certain incoming port.  Often 
  261. port is the same as retport on a netusend().  Any packets 
  262. for this port will be kept for reading later.  Another 
  263. packet for this port before a neturead will overwrite the 
  264. last one.  This should be expanded later to give similar 
  265. socket addressing as TCP uses.
  266.  
  267. theevent = netgetevent(class,theclass,dat)
  268. int class;        Classes to search for (OR combination)
  269. int *theclass;        Actual class of the event returned (return value)
  270. int *dat;        Data which tags the event
  271. int theevent;        Which event has occurred
  272. Receive the next event in the queue.  Classes are in 
  273. whatami.h.  Not usually called by the user because the user 
  274. will want the session layer handling of Sgetevent().  
  275. Returns 0 on no event available.
  276.  
  277. netputevent(class,event,dat)
  278. int class;        Class of the event to post
  279. int event;        Which event within that class to post
  280. int dat;            The data to carry in the event queue
  281. Place an event into the event queue to be picked up later.  
  282. The user may want to define classes to be posted this way.   
  283. See Sgetevent().
  284.  
  285. netputuev(class,event,dat)
  286. int class;        Class of the event to post
  287. int event;        Which event within that class to post
  288. int dat;            The data to carry in the event queue
  289. Place an event into the event queue.  First checks to see if 
  290. there already is an identical such event.  If so, another 
  291. copy will not be posted.
  292.  
  293. netposterr(enum)
  294. int enum;        Error number in errorclass.
  295. Post a user error message.  The error message is one from 
  296. the list in TOOLS.C.  This message will wait in the queue 
  297. until an ERRORCLASS event is requested.
  298.  
  299. cnt = neturead(buf)
  300. char *buf;        data area to drop the UDP packet (<512 bytes)
  301. int cnt;            actual length of the packet which is ready
  302. Reads the data from a UDP packet which was received.  
  303. Returns the number of bytes read into buf, or -1 if there is 
  304. no packet available to read.  Automatically clears the 
  305. incoming UDP buffer for the next read.
  306.  
  307. Session Layer routines
  308.  
  309. hostform.h
  310. Include file which contains the structure of the machine 
  311. information record and the configuration information record.  
  312. Use these structures with the following calls to read or 
  313. manipulate machine specific information.  Includes struct 
  314. machinfo and struct config.
  315. whatami.h
  316. Currently contains the definition of PC vs. Mac in terms of 
  317. program and compiler settings to get the code to compile on 
  318. both the Mac and PC.  Also includes netevent.h.
  319. netevent.h
  320. Contains the list of event types, both low-level event types 
  321. used internally, and the events which the application 
  322. program will pay attention to.   See documentation section 
  323. on rules for event handling that explain what you can do 
  324. with events.
  325.  
  326.  
  327. Sgetconfig(conp)
  328. struct config *conp;    Pointer to a config structure which will receive a 
  329. copy of current data
  330. Copies the config structure to user memory.  The hosts file 
  331. contains a lot of configuration information that the 
  332. application may need to know.  The structure of the data 
  333. area is in hostform.h.  
  334.  
  335. mp = Shostlook(name)
  336. char *name;        name of machine to get information about
  337. struct machinfo *mp;    Pointer to machine information record
  338. Takes a machine name (standard ASCII string) and returns a 
  339. pointer to the machine information record associated with 
  340. that name.  Searches the sname field first, then the hname 
  341. field.  Returns NULL if not found.  The structure definition 
  342. is in hostform.h.  Take care when writing to fields in this 
  343. structure (i.e. don't).  If you mess up the data, strange 
  344. things may happen.  Shostlook does  a simple lookup on the 
  345. name field, so the "default" record can be looked up if 
  346. necessary.
  347.  
  348. mp = Sgethost(name)
  349. char *name;        name or IP number of machine to get information about
  350. struct machinfo *mp;    Pointer to machine information record
  351. Takes a machine name or IP number in ASCII format 
  352. (192.17.20.10) or a special shorthand form (#10) and returns 
  353. a pointer to the machine information record associated with 
  354. that name.   Uses Shostlook() to look up name if number is 
  355. not used.  Returns NULL if not found.  The structure 
  356. definition is in hostform.h.  Sgethost guarantees that the 
  357. record returned has a valid IP number which Snetopen() will 
  358. accept.  Sgethost should be the primary lookup call to 
  359. determine whether the domain name server is required or not.  
  360. If the IP number is given, a pointer to the "default" 
  361. machine is returned with a temporary IP number installed.  
  362. "default" cannot be returned as a real machine because 
  363. Sgethost guarantees a real IP number in the machine record.
  364.  
  365. mp = Slooknum(mnum)
  366. int mnum;        Machine number to look for
  367. struct machinfo *mp;    Pointer to machine information record
  368. Used primarily for domain lookups, this number is unique for 
  369. all entries in the memory host list.
  370.  
  371. mp = Slookip(ipnum)
  372. char *ipnum;        IP number of the host to look for
  373. struct machinfo *mp;    Pointer to machine information record
  374. Look up host information when you know the host's IP number.  
  375. Used by background ftp server.
  376.  
  377. mp = Smadd(name)
  378. char *name;        ASCII name of the host to add to the memory host list
  379. struct machinfo *mp;    Pointer to machine information record
  380. Adds a machine to the host list, generating a unique host 
  381. number for it.  Copies the configuration information from 
  382. "default".  Returns a pointer to the machine record created.  
  383. Returns NULL if no memory could be allocated.  Be careful 
  384. updating the information in the machine record.  If the name 
  385. already exists somewhere as a session or host name, it just 
  386. returns that record pointer.
  387.  
  388. Shostfile(newname)
  389. char *newname;    pointer to new configuration file name
  390. Takes a pointer to static storage of the host file name.   
  391. The storage associated with the name must remain allocated.  
  392. Default is "config.tel".  Typically called with an argv[] 
  393. parm.
  394.  
  395. Snetinit()
  396. Calls Sreadhosts(), netinit(), neteventinit(), and 
  397. Ssetgates() for you and initializes the timer queue.    
  398. Returns non-zero on error.  Sreadhosts() sets up the config 
  399. structure, so Sgetconfig() can be called after Snetinit().  
  400. RARP handling is done in Snetinit() - if RARP fails, 
  401. Snetinit returns -2 -- this condition requires a netshut() 
  402. to clear any interrupt drivers.  A -1 return means that the 
  403. netinit() never succeeded so the interrupt drivers were 
  404. never installed.
  405.  
  406. Sreadhosts()
  407. Reads the hosts file, using the filename provided by 
  408. nethostfile().  Uses the new type of config file.  Sets 
  409. Smachlist to NULL before reading the file and creating the 
  410. list.  Processes and logs all information to the config 
  411. structure or into the machinfo list.  Calls some of the 
  412. setup options for ftp, rcp, screen modes, etc.  Called by 
  413. Snetinit, user does not need to call this routine. 
  414.  
  415. Ssetgates()
  416. This routine is called by Snetinit() automatically.  It sets 
  417. the netmask with the field read from the hosts file, turns 
  418. on ftp and rcp if they are specified in the hosts file, and 
  419. traverses the machinfo list to set up any gateways which are 
  420. marked.
  421.  
  422. pn = Snetopen(mp,tport)
  423. struct machinfo *mp;    Machine information record obtained from Sgethost()
  424. int tport;        TCP port to attempt connection with
  425. int pn;            Port number passed through from netopen()
  426. Tries to connect to the specified port on that machine and 
  427. returns the port descriptor for netread and netwrite.  
  428. Should be used instead of netopen().  Calls netopen() and 
  429. uses any special configuration information found in the 
  430. machinfo record.  Sets a timer for the connection timeout 
  431. which will be posted in an event.  You cannot access this 
  432. connection until you are notified with an event that shows 
  433. the connection opened or failed.
  434.  
  435. Sdomain(name)
  436. char *name;        name of the machine to look up, s/b in DOMAIN format
  437. Tries to use the DOMAIN name server to look up the IP number 
  438. of the named host.   Sdomain() posts appropriate events to 
  439. notify you of the results.  If the name does not have any 
  440. periods, the default suffix from the config structure is 
  441. added to the lookup.  All domain events return a machine 
  442. number which can be looked up with Slooknum() to find out 
  443. which machine is referred to.   Remember, the local host 
  444. file lookup is faster, so look up the machine name with 
  445. Sgethost() first.  Returns 0 on success, -1 if there is no 
  446. name server to query.
  447.  
  448. Snewns()
  449. Rotate name servers.  If there is more than one nameserver 
  450. in the machine list, the one with the next highest number 
  451. will become the current nameserver.  Wraps to nameserver 1 
  452. when there are no more nameservers.
  453.  
  454. Ssetns(ipn)
  455. char ipn[4];        IP number of nameserver to become primary nameserver.
  456. For situations when your primary nameserver is not indicated 
  457. in the config file, but is obtained over the network 
  458. somehow, this sets that host up as nameserver #1.  The ns #1 
  459. set by Snewns() will rotate to ns #2 as necessary.
  460.  
  461. Stask()
  462. Should be called instead of netsleep() to support the timer 
  463. queue and network updates.   Sgetevent() calls Stask() for 
  464. you.  The FTP server can't function without repeated Stask() 
  465. calls.
  466.  
  467. Stimerset(class,event,dat,howlong)
  468. int class;        Class of event which should be posted
  469. int event;        Event number which should be posted
  470. int dat;            Associated data which should be posted
  471. int howlong;        Seconds to wait before posting this event
  472. Stimerset() adds events to the timer queue.  Stask() 
  473. contains the checks to post any events which have come due. 
  474.  
  475. Stimerunset(class,event,dat)
  476. int class;        Class of event which should be dequeued
  477. int event;        Event number which should be dequeued
  478. int dat;            Associated data which should be dequeued
  479. Searches the timer queue for a matching entry and removes 
  480. the entry from the queue without generating an event.  The 
  481. timer may have just gone off with the event in the event 
  482. queue.  This procedure will not prevent that event from 
  483. occurring, only those which have unexpired timers are 
  484. removed.
  485.  
  486. theevent = Sgetevent(class,theclass,dat)
  487. int class;        Classes to search for (OR combination)
  488. int *theclass;        Actual class of the event returned (return value)
  489. int *dat;        Data which tags the event
  490. int theevent;        Which event has occurred
  491. Sgetevent() does the background processing of ftp, rcp and 
  492. domain name lookup.  Events are posted with netputevent() 
  493. and are usually posted by lower layer routines.  Calling 
  494. Snetopen() will guarantee that you will get either a CONOPEN 
  495. or CONFAIL event depending on how things went.  The 
  496. associated data for CONXXXX events is always the port number 
  497. of the connection involved.  The routine will return 0 if 
  498. there are no events available.  Class types are in whatami.h 
  499. and the user may define new events and classes as described 
  500. under "events".  
  501. Currently, it is quite common to receive undesired extra 
  502. events which are for ports which you don't have defined.  
  503. Check the data tag for validity.
  504.  
  505. FILE *Sopencap()
  506. Opens the capture file with the previously stored name.  
  507. Returns a file pointer or NULL if there is an error.  Use 
  508. Snewcap() to change the name.  Always opens for append.
  509. Snewcap(name)
  510. char *name;        Name to use for a capture file
  511. Copies the name into private storage for use by Sopencap().  
  512. Limit of 80 chars on name length (no warning).
  513.  
  514. Stekmode(m)
  515. Sftpmode(m)
  516. Srcpmode(m)
  517. Scwritemode(m)    
  518. int m;            Value of boolean flag to set
  519. Sets modes and turns switches for the session layer.  Tek is 
  520. tektronix mode.  FTP and rcp turn the listeners on and off.  
  521. When writemode is 1 (true), direct writes to the screen 
  522. should be enabled.  Tek and writemode are simply services to 
  523. the upper layers, they only store the boolean flag.
  524.  
  525. Stmode()
  526. Sfmode()
  527. Srmode()
  528. Scmode()    
  529. Returns the value of the boolean flag set above.  
  530.  
  531. Snewpsfile(s)
  532. Snewhpfile(s)
  533. Snewtekfile(s)
  534. char *s            new file name to use
  535. For each of the graphic options, Postscript, tek and HPGL, 
  536. the configuration structure maintains a filename as a 
  537. service to higher layers.  These routines change those 
  538. filenames.  Pointers to the filenames are obtained through 
  539. the structure copy which is retrieved from Sgetconfig().
  540.  
  541. Scheckpass(user,passwd)
  542. char *user;        User name to check the password of
  543. char *passwd;        The password to check the validity of
  544. Returns true if the passwd associated with the user field 
  545. matches the value in the password file associated with 
  546. telnet.  If there is a password file and the username is not 
  547. present, returns false.  If no password file is specified in 
  548. the hosts file, returns true.
  549.  
  550. Sneedpass()
  551. Returns a boolean flag indicating whether we need to check 
  552. FTP passwords.  The determination is made depending upon 
  553. whether there has been a filename specified with the 
  554. passfile option in the config file.
  555.  
  556. Scompass(password,encrypt)
  557. char *password;    The password to compare
  558. char *encrypt;        The encryption to check against
  559. Checks to see if the encrypted string has been encrypted 
  560. from a particular password string.   Returns true or false.
  561.  
  562. Sftpname(s)
  563. char *s;        Space to copy the name of the file being transferred
  564. The name of the current file being transferred by FTP is 
  565. stored internally.  Use Sftpname() to get a copy of that 
  566. internal name.
  567.  
  568. Sftphost(host)
  569. char *host;        Space to copy the name of the host involved.
  570. The IP number of the FTP client for FTP transfers is stored 
  571. internally.  Use Sftphost() to get a copy of that internal 
  572. number.  Then you can look up the host's name with 
  573. Slookip().
  574.  
  575. Sftpuser(user)
  576. char *user;        Space to copy the username.
  577. The name field from the FTP USER command is stored 
  578. internally.  Use Sftpuser() to get a copy of that name.
  579.  
  580. Sftpstat(bytes)
  581. long *bytes;        Pointer to long, number of bytes
  582. The value copied into this long int returns number of bytes 
  583. transferred or left to transfer in the currently active ftp 
  584. transfer.  Used to update status displays.
  585.  
  586.  
  587.  
  588. Events -- how to use them
  589.  
  590. The routines netgetevent() (at a low level) and 
  591. Sgetevent()(at the session level) look for events which are 
  592. stored in NCSA Telnet's event queue.  Sgetevent() calls 
  593. netgetevent(), so if you are using the session layer 
  594. library, you will never call netgetevent().  Sgetevent() 
  595. sifts through the events and captures events related to the 
  596. background name serving and ftp file transfers.  All other 
  597. events are passed through to the application.
  598. Classes
  599. Events are divided into classes to help different portions 
  600. of the application look for only certain kinds of events.   
  601. When you call one of the getevent routines, the class which 
  602. you pass to the routine is a mask of the OR combination of 
  603. the classes that you want to retrieve from the event queue.  
  604. When the routine returns with a greater than zero event 
  605. number, that mask will have been transformed into the exact 
  606. class to which the returned event belongs.  The classes are 
  607. defined below.
  608. Events
  609. For each class, several events are defined.  They are 
  610. documented individually, along with the use of the data 
  611. value which is returned from the getevent call.
  612. User-defined events
  613. Applications programmers are welcome to use class 0x80 (128) 
  614. for their own events.  Events in each of the predefined 
  615. classes in the range 128-255 are also available for use.  
  616. Specifically, use events 128-255 of the USERCLASS because 
  617. they will be more convenient to use.  Use of any events or 
  618. classes not in these ranges may conflict with future NCSA 
  619. software.  If you want certain events to be defined by NCSA, 
  620. let us know.  The official "defined events" list will be 
  621. updated periodically.
  622. Timer events
  623. Stimerset() and Stimerunset() control a separate queue from 
  624. the event queue.  The important thing to know is that when a 
  625. timer goes off, it places its specific event into the event 
  626. queue.  You may use user-defined event types to set timers 
  627. for yourself in this queue.  Some events like DOMFAIL and 
  628. CONFAIL are caused by timers if something doesn't occur to 
  629. unset the timers for those events.
  630. minitel.c
  631. Look at minitel.c for the simplest possible telnet.  This 
  632. one doesn't even have a telnet command parser and it only 
  633. talks to BSD hosts.  It does show you how to handle events 
  634. for the simple cases.
  635.  
  636. The following events are defined in netevent.h:
  637.  
  638.  
  639. #define USERCLASS    1
  640. #define ICMPCLASS    2
  641. #define ERRCLASS        4
  642. #define SCLASS    8
  643. #define CONCLASS    0x10
  644.  
  645. #define ERR1        1    /* an error message is waiting, ERRCLASS */
  646.  
  647. #define IREDIR    1    /* ICMP redirect, ICMPCLASS */
  648.  
  649. #define CONOPEN     1    /* connection has opened, CONCLASS */
  650. #define CONDATA     2      /* there is data available on this connection */
  651. #define CONCLOSE     3    /* the other side has closed its side of the connection */
  652. #define CONFAIL     4    /* connection open attempt has failed */
  653.  
  654. #define UDPDATA     1    /* UDP data has arrived on listening port, USERCLASS */
  655. #define DOMOK        2    /* domain name ready */
  656. #define DOMFAIL     3    /* domain name lookup failed */
  657. #define FTPCOPEN     20     /* FTP command connection has opened */
  658. #define FTPCLOSE     21     /* FTP command connection has closed */
  659. #define FTPBEGIN    22     /* FTP transfer beginning, dat =1 for get, 0 for put */
  660. #define FTPEND       23     /* FTP transfer ending */
  661. #define FTPLIST     24     /* FTP file listing taking place */
  662. #define FTPUSER      25     /* FTP user name has been entered */
  663. #define FTPPWOK     26     /* FTP password verified */
  664. #define FTPPWNO     27     /* FTP password failed */
  665. #define RCPBEGIN     30    /* RCP beginning */
  666. #define RCPEND     31    /* RCP ending */
  667.  
  668. #define UDPTO     1    /* UDP request from DOMAIN timed out, SCLASS */
  669. #define FTPACT    2    /* FTP transfer is active, keep sending */
  670. #define TCPTO      3    /* TCP for DOMAIN timed out */
  671. #define RCPACT     4    /* rcp is active, needs CPU time */
  672. #define RETRYCON     5    /* retry connection packet, might be lost */
  673.  
  674.  
  675.  
  676. Class USERCLASS
  677. Event UDPDATA
  678. To get this event you must have already called netulisten 
  679. with a port number.  A UDP packet with some data has arrived 
  680. for you on that port.  The data field for the event is the 
  681. UDP port number which you were listening to.  In the future, 
  682. you will be able to listen to multiple ports and the data 
  683. field will become important.  Port 998 is arbitrarily used 
  684. by our domain name server.
  685. Event DOMOK
  686. To get this event, you must have already placed a domain 
  687. name request.  You may get more than one DOMOK for one 
  688. request.  The data field contains the machine number of the 
  689. name you looked up.  You can look up the machine record with 
  690. Slooknum() now.  The IP number has been placed into the 
  691. record.  A Snetopen() with that machine record should 
  692. succeed now.
  693. Event DOMFAIL
  694. To get this event, you must have already placed a domain 
  695. name request.  You may get more than one DOMFAIL for one 
  696. request.  The data field contains the machine number of the 
  697. name you looked up.  That machine name could not be 
  698. resolved.   You may also have an error event waiting for you 
  699. which explains why the resolve failed.
  700. Event FTPCOPEN
  701. A command connection has been established to your background 
  702. FTP server.  NCSA Telnet uses this to post informative 
  703. messages.
  704. Event FTPCLOSE
  705. The command connection for your server FTP has closed.
  706. Event FTPBEGIN
  707. A file transfer to or from your machine has begun.  The data 
  708. field=1 for get (transfer from) and 0 for put (transfer to) 
  709. transfers.
  710. Event FTPEND
  711. A file transfer or a LIST command has ended.
  712. Event FTPLIST
  713. A LIST command has begun for your background FTP.
  714. Event FTPUSER    
  715. A USER command has been entered for the background FTP.
  716. Event FTPPWOK
  717. An FTP PASS command has been entered and verified by 
  718. comparing to the entries in the password file.
  719. Event FTPPWNO
  720. An FTP PASS command has been entered and rejected by failing 
  721. to match anything in the password file.
  722. Event RCPBEGIN
  723. Someone has started an rcp transfer to or from your 
  724. computer.
  725. Event RCPEND
  726. That rcp has ended.
  727. Class ICMPCLASS
  728. Event IREDIR
  729. The netsleep() routine automatically does a netgetevent() 
  730. for ICMP redirect messages and performs the addressing 
  731. change required by the ICMP redirect.  When an ICMP redirect 
  732. packet is received, this event is posted by the ICMP 
  733. routine.  Bugfix in 2.2 makes sure ALL redirects are 
  734. registered.
  735. Class ERRCLASS
  736. Event ERR1
  737. There is currently only one error event which pertains to 
  738. all of the possible errors.  These events should be 
  739. reclassified as ERRWARNING, ERRINFO, ERRFATAL, etc., so the 
  740. rest of this class is reserved.  The data field contains the 
  741. error number which can be looked up with neterrstring().
  742. Class SCLASS (session class)
  743. The entire SCLASS is for special session layer events.  You 
  744. will not receive these events from Sgetevent() because they 
  745. are always removed.
  746. Event UDPTO
  747. The current UDP domain request timed out.
  748. Event FTPACT
  749. When FTP is active, it uses as much CPU as it can get.  To 
  750. get more CPU it posts events back to itself.
  751. Event TCPTO
  752. not used, we don't need TCP lookups.
  753. Event RCPACT
  754. rcp posts this event back to itself when it needs CPU.
  755. Event RETRYCON
  756. Snetopen() posts this in a timer to send multiple SYN 
  757. packets if the first one is lost.
  758. Class CONCLASS
  759. Event CONOPEN
  760. A connection has just opened.  This may be a connection 
  761. which you are listening to, or one which you are trying to 
  762. open with Snetopen().  Remember Snetopen() does not block 
  763. until the connection is open.  The data field returns the 
  764. port number (descriptor) of the connection.
  765. Event CONDATA
  766. Data has arrived for a certain port number.  The data field 
  767. contains that port number.  Because this event always comes 
  768. up when there is data in the incoming TCP buffer, you never 
  769. have to poll netread() to find out if there is data to be 
  770. read.  If you get CONDATA events, there is data to be read, 
  771. if you are not getting CONDATA events, then there won't be 
  772. data to be read.  Unless you drop an event, of course.  
  773. CONDATA events which arrive after a CONCLOSE event or a 
  774. netclose() call may get a -1 return from netread(), 
  775. indicating that the connection has no more data or does not 
  776. exist.
  777. Event CONCLOSE
  778. If the host you are talking to decides to drop the 
  779. connection, or reset it, then you may get a CONCLOSE event.  
  780. This can be interpreted as the last CONDATA event that you 
  781. will get.  There may be a large amount of data waiting for 
  782. you to pick it up with netread() even after receiving a 
  783. CONCLOSE event.  The correct procedure is to take data from 
  784. netread() until you receive a 0 or -1 return code and then 
  785. call netclose() to finalize your side of the connection.
  786. Event CONFAIL
  787. The timer ran out on a connection which you tried to open.  
  788. This does not mean that you are done.  You must netclose() 
  789. to allow the memory for that port to be re-used.
  790.  
  791.  
  792. Virtual Screen Kernel Calls
  793.  
  794. Gaige B. Paulsen                            October 31, 1987
  795.                                     updated July 14, 
  796. 1988
  797.  
  798. int VSinit(max)
  799. int max;        Maximum number of Virtual screens to allow.
  800. Initializes the Virtual Screen Kernel for use with up to max 
  801. screens. 
  802. Returns 0 if successful.
  803.  
  804. VSscrn *VSwhereis(i)
  805. int i;            Virtual Screen to examine.
  806. Returns the current address of the virtual screen control 
  807. record.  This is used for debugging.
  808.  
  809. int VSnewscreen( maxlines, screensave, maxwid, IDC)
  810. int maxwid;        How wide can this window be.  Only tested for 80 and 132.
  811. int maxlines;        Maximum number of lines to save.
  812. int screensave;    Is scrollback enabled at start?
  813. int IDC;        Do we have support for insert and delete of characters.
  814.  
  815. Creates a new screen if possible.   VSnewscreen returns a 
  816. number >=0 if it succeeds, which is to be used as the window 
  817. parameter(w) in all subsequent calls to vs routines.  If the 
  818. return value is <0, there was an error, and no screen was 
  819. created.
  820.  
  821. VSdestroy(w)
  822. int w;            Window number to destroy.
  823. Destroy the window corresponding to w.  Returns an error if 
  824. applicable.
  825.  
  826. VSdetatch(w)
  827. int w;            Window number to detach.
  828. Detach the window corresponding to w.  Returns an error if 
  829. applicable.  Note that this function currently just calls 
  830. VSdestroy(w).  Previously and hopefully sometime in the 
  831. future as well, it did/will allow for the destruction of a 
  832. screen without freeing memory.
  833.  
  834. VSredraw(w,x1,y1,x2,y2)
  835. int w;            Window number to redraw.
  836. int x1, y1,x2,y2;    Bounds of the rectangle to be drawn, in local window 
  837. coordinates.
  838. Redraw the portion of window w which lies within (x1,y1) - 
  839. (x2,y2).  The coordinates are local to the window and should 
  840. NOT be adjusted for scrollback, as most of scrollback is 
  841. handled by the VS routines and not the RS.
  842.  
  843. VSwrite(w,ptr,len)
  844. int w;            Window number to write to.
  845. int  len;        How many characters to write.
  846. char *ptr;        Where to get the characters.
  847. The big routine.  This one is called to write a character 
  848. stream to the virtual screen w.  VSwrite calls VSem to parse 
  849. the emulation.
  850.  
  851. VSclear(w)
  852. int w;            Window number to clear.
  853. Clear the virtual screen of window w.
  854.  
  855. char VSkbsend(w,k,echo)
  856. int w;            Window number to send the characters from.
  857. int echo;        Boolean - whether to local echo the key.
  858. unsigned char k;    VT-100 key code to send
  859. Sends the VT-102 representation of the key represented by k.  
  860. This routine uses somewhat of a hack by calling RSsendstring  
  861. which is supposed to know how to send characters to 
  862. whichever port corresponds to window w.  The echo flag only 
  863. applies to special keys (like arrows) and will cause them to 
  864. echo on the local screen as they are transmitted.
  865.  
  866. VSclearall(w)
  867. int w;            Window number to clear all of.
  868. This routine currently does nothing.  It was originally 
  869. intended clear the current screen and all of the scrollback 
  870. as well as setting the top of the scrollback to the top of 
  871. the available storage space, but this was deemed 
  872. unnecessary.....at least for now.
  873.  
  874. VSreset(w)
  875. int w;            Window number to reset.
  876. Resets the virtual screen (w) with respect to VT-100 modes.  
  877. Changes the wrap mode to off and clears the screen as well 
  878. as setting all other modes to their ORIGINAL POWER-ON 
  879. defaults as specified by the VT-100 programmers manual.
  880.  
  881. char *VSgetline(w,y)
  882. int w;            Window number to get line from.
  883. int  y;            Line from which to get the pointer
  884. This routine in now out of date and SHOULD NOT BE USED 
  885. unless you really know what you are doing.  It retrives a 
  886. pointer to the data string associated with line (y) of the 
  887. screen (w).  This ONLY works with lines that are on the 
  888. active vt100 screen (lines 0-23).
  889.  
  890. VSsetrgn(w,x1,y1,x2,y2)
  891. int w;            Window number to set the display region for.
  892. int x1,y1,x2,y2;    The vs's bounding rectangle in GLOBAL VS coordinates .
  893. Set the current display region for window w to (x1,y1)-
  894. (x2,y2).  This will perform 
  895. scrollback/scrollforward/scrollleft/scrollright/etc. as 
  896. necessary to make the current screen reflect the values of 
  897. the passed display region.  It restricts you from doing 
  898. anything really stupid (I hope).
  899.  
  900. VSgetrgn(w,x1,y1,x2,y2)
  901. int w;            Window number to scroll forward in.
  902. int *x1,*y1,*x2,*y2;    Where to retrieve the display region into.
  903.  
  904. Get the current value of the display region (as set by 
  905. setrgn and/or modified by the scroll routines as well as 
  906. auto--scroll).  Pass pointers to the integers you would like 
  907. to have the values put into.
  908.  
  909. VSscrolback(w,in)
  910. int w;            Window number to scroll back in.
  911. int in;            Number of lines to scroll back.
  912. Scroll back in lines in window w if possible.  Note that 
  913. this routine will prevent you from scrolling back beyond the 
  914. top of the buffer, so it is safe to call it whenever you get 
  915. a request to scroll back further, even if you don't know if 
  916. there is data left to scroll back into.
  917.  
  918. VSscrolforward(w,n)
  919. int w;            Window number to scroll forward in.
  920. int n;            Number of lines to scroll forward.
  921. Scrolls forward n lines in window w.  See VSscrolback for 
  922. details.
  923.  
  924. VSscrolright(w,n)
  925. int w;            Window number to scroll right in.
  926. int n;            Number of columns to scroll right.
  927. Scrolls right n columns in window w.  See VSscrolback for 
  928. details.
  929.  
  930. VSscrolleft(w,n)
  931. int w;            Window number to scroll forward in.
  932. int n;            Number of columns to scroll left.
  933. Scrolls left n columns in window w.  See VSscrolback for 
  934. details.
  935.  
  936. VSscrolcontrol(w,scrolon,savescroll)
  937. int w;            Window number to set scroll variables for.
  938. int scrolon;        Do we scroll or don't we?
  939. int savescroll;        Save cleared lines into scrollback.
  940. Changes the value of the scrolon variable in window w, 
  941. therefore disabling and enabling scrollback, not really 
  942. necessary.  If savescroll is on, all clearscreen commands 
  943. will load the text into the scrollback buffer.
  944.  
  945. VSsnapshot(w)
  946. int w;            Window number to take snapshot of.
  947. Currently does nothing.  Will/should eventually make a copy 
  948. of the current screen into the scrollback buffer.  This is 
  949. most easily done by sending 24 line feeds and then copying 
  950. the values of lines (-24) - (-1) into 0-24.  But, I hope to 
  951. do this before  2.1 and the source release.
  952.  
  953. int VSmaxwidth(w)
  954. int w;            Window number to retrieve the maximum width of.
  955. Retrieves the current maximum width of window w.  Used 
  956. primarily to get the maximum possible size of a selection 
  957. for copying. NOTE: a 132 column window in 80 column mode 
  958. returns 80.
  959.  
  960. long VSgettext(w, x1, y1, x2, y2, charp, max, EOLS)
  961. int w;            Window number to get text from.
  962. int x1,y1,x2,y2;    The starting and ending points of the text in global VS 
  963. coordinates .
  964. char *charp;        Pointer to the destination of the gotten text.
  965. char  *EOLS;        Pointer to the string to be used for end of line.
  966. long max;        Maximum number of characters charp can hold.
  967. Copies a section of text from window w, which corresponds to 
  968. an area starting from the x1th character of line y1 to the 
  969. x2th character of line y2, inclusive of all of the 
  970. characters on lines y1+1 to y2-1  into a buffer pointed at 
  971. by charp to exceed no more than max and inserting the string 
  972. pointed at by EOLS whenever there is a line transition.  
  973. (...whew...) This is mainly used for copy and print of VS 
  974. data.  Extraneous blanks are ommitted at the end of lines by 
  975. searching backward to the beginning of the line.
  976.             
  977. Global  VS coordinates vs. local coordinates
  978.  
  979. Global
  980. Global coordinates are used to represent a range of 
  981. information that can span the entire VS space as it 
  982. currently exists.   To accurately portray the area, we must 
  983. have some standard method of referring to scrollback.  For 
  984. this, we have chosen to refer to the top of the currently 
  985. active VT-102 screen as line 0, the bottom of the active 
  986. screen as line 23, and the lines of scrollback as negative 
  987. offsets from line 0.  Hence, a line that has been scrolled 
  988. off by a CR-LF would be seen as line -1.  To perform actions 
  989. such as scrolling back to the top of the virtual screen, you 
  990. would ask for lines from (top of buffer) to (top of buffer 
  991. +length of display window).  Similarly, if you wished to 
  992. scroll to make the right hand side of a 132 column window 
  993. visible, you would ask for the columns from (maxwidth -20) 
  994. to (maxwidth).
  995. Local 
  996. Local coordinates are used to represent things that happen 
  997. relative to the area being displayed by the Virtual Screen.  
  998. An example would be a portion (or all) of the virtual screen 
  999. being made visible.  This action would cause whichever lines 
  1000. are in the visible area to be redrawn, therefore you will 
  1001. need to inform the VS routines to do this.  Since the VS 
  1002. routines attempt to maintain as much of the information 
  1003. about scrollback by themselves so as not to burden you with 
  1004. extraneous information, you pass these coordinates as local 
  1005. to the currently active screen.  Therefore, a full redraw 
  1006. would be line 0 character 0 through line 23 character 79, 
  1007. which would then be translated by VSredraw to whatever 
  1008. global coordinates are appropriate.
  1009.  
  1010. Replacing the Terminal Emulation package in the VS 
  1011. routines.
  1012.  
  1013. The VS routines can be used as a basis for just about any 24 line screen 
  1014. terminal emulator.  This document shows how to use the internal routines in 
  1015. vsintern.c to construct a  vsem.c file as a basis for a new terminal emulator.  
  1016.  
  1017. VSem(c,ctr) -
  1018. char *c     pointer to the buffer to use as input to the emulator
  1019. int ctr        how many characters to read from the input buffer
  1020.  
  1021. This is the main emulation routine.  It is the entry point from VSwrite and 
  1022. should be the only thing that needs to be replaced when changing the terminal 
  1023. emulation.
  1024.  
  1025.     escflg: current escape state
  1026.         0 - normal character wait
  1027.         1 - have escape, waiting for next character
  1028.         2 - escape '[' sequence, waiting for parameters
  1029.         3 - escape '#' sequence
  1030.         4 - escape '(' sequence
  1031.         5 - escape ')' sequence
  1032.     c:     pointer to character currently being parsed
  1033.     VSIw: points to the window structure for the current window.
  1034.     VSIwn: is the current window number
  1035.  
  1036. VSI routines from vsintern.c for use in emulation
  1037.  
  1038. VSIreset()            - Cause a terminal reset
  1039. VSItabinit()        - Initialize tabs to default stat (every 8             
  1040.         characters)
  1041. VSItabclear()        - Clear the tab at the current position
  1042.  
  1043. VSIdellines(n,s)        - delete n lines at s (current line if s<0)
  1044. VSIinslines(n,s)        - insert n lines at s (current line if s<0)
  1045.  
  1046. VSIeeol()            - erase to end of line
  1047. VSIebol()            - erase to beginning of line
  1048. VSIel(s)            - erase the entire line s (current line if s<0)
  1049. VSIeeos()            - erase to end of screen
  1050. VSIebos()            - erase to beginning of screen
  1051. VSIes()            - erase the whole screen
  1052.  
  1053. VSIrange()            - check and resolve range errors for x and y
  1054.  
  1055. VSIdraw( VSIwn, x, y, a, len, c)
  1056.                 - draw len characters at (x,y) in attribute a
  1057.                     with the chars at c
  1058. VSIinsstring(len,start)    - insert len characters at the current position         
  1059.             with the chars at start
  1060.  
  1061. VSIdelchars(x)        - delete x characters at the current position
  1062. VSIinschar(x)        - insert x blank characters at the current position
  1063. VSItab()            - move to next tab stop
  1064. VSIsave()            - save current x, y, a
  1065. VSIrestore()            - restore previous x,y,a
  1066.  
  1067. VSIindex()            - index one line
  1068. VSIrindex()            - reverse index one line
  1069.  
  1070. VTsendpos()            - Send the VT-100 cursor report
  1071. VTsendstat()            - Send the VT-100 status report
  1072. VTsendident()        - Send the VT-100 identity report
  1073. VSIsetoption(toggle)    - Set the VT-100 option depending on toggle
  1074.  
  1075.  
  1076.  
  1077. How to write a new PC driver
  1078.  
  1079. There are six routines which must be provided in a new 
  1080. driver.  All of these routines are currently provided in 
  1081. assembly language in one file.   When you write a new 
  1082. driver, you will probably take a current driver and replace 
  1083. each of the six routines in the file.  The current examples 
  1084. are in the ENET subdirectory and the three best examples 
  1085. are:
  1086.  
  1087. NET501.ASM
  1088. 3COM 3C501 driver.  Uses interrupts,  and will be a 
  1089. reasonable template for other interrupt-driven drivers.  I 
  1090. highly discourage trying to improve this driver for the 
  1091. 3C501.  I've tried.
  1092. NETUB.ASM
  1093. Ungermann-Bass (IBM) NIC board driver.  Does not use 
  1094. interrupts.  This driver may be a good template for simple 
  1095. shared-memory boards which divide the memory into pages.
  1096. NET5210.ASM
  1097. MICOM NI5210 driver.  The NI5210 uses the Intel 82586 chip.  
  1098. You will need the Intel databook for this chip in order to 
  1099. understand the driver.  This driver should be directly 
  1100. applicable to all boards which are built around the 82586.  
  1101. Works with 8K or 16K boards.  Only uses 8K of a 16K board, 
  1102. so save your money.
  1103.  
  1104. With dual-ported RAM and intelligent chipsets, interrupts are entirely 
  1105. unnecessary.  The board will automatically buffer a certain number of packets 
  1106. which are picked up when NCSA Telnet has time to process incoming packets.  
  1107. TCP takes care of preventing overruns.
  1108.  
  1109. The six routines are described below.  They generally return -1 on error.  
  1110. getaddr() is usually called first and etopen must be called next for any of 
  1111. the other routines to make sense.  Function pointers for the routines are 
  1112. declared and installed in PCTOOLS.C.  A new driver should install new pointers 
  1113. right alongside the existing ones.
  1114.  
  1115. etopen(eaddr,irq,addr,ioaddr)
  1116. char  eaddr[6];        Hardware ethernet address to use on board.
  1117. int irq;            Interrupt request level from configuration file.
  1118. int addr;        Shared memory base segment address from configuration file.
  1119. int ioaddr;        I/O address from configuration file.
  1120. This routine must do all of the initializations for the 
  1121. Ethernet board.  Any interrupt drivers must be placed, 
  1122. interrupts turned on, base register variables set up, 
  1123. packets initialized and the address set for the board.  Do 
  1124. not return until you are receiving packets.  Most drivers 
  1125. will ignore some of the fields provided.  Map them to 
  1126. whatever values are appropriate for your hardware.
  1127.  
  1128. getaddr(eaddr,addr,ioaddr)
  1129. char eaddr[6];        Buffer to place address.
  1130. int addr;        Base segment address for shared memory
  1131. int ioaddr;        Base I/O address for board
  1132. Some of these parameters are also ignored, depending upon 
  1133. the hardware.  The hardware address from the board's EPROMs 
  1134. should be copied into the eaddr buffer.  This address is 
  1135. generally given back to etopen, so getaddr cannot depend on 
  1136. etopen's initialization.
  1137.  
  1138. etclose()
  1139. Shut down Ethernet board.  Primarily to turn off interrupts.  
  1140. This routine can be just a RET for non-interrupt boards.
  1141.  
  1142. recv()
  1143. Receive a packet.  Used only for boards that do not use 
  1144. interrupts.  The interrupt handler generally replaces the 
  1145. need for recv().  The interrupt handler or recv() must use 
  1146. my undocumented buffering scheme.  Generally, keep the same 
  1147. code and replace the board handling side.
  1148.  
  1149. xmit(packet,size)
  1150. char *packet;        Address of packet to transmit.
  1151. int size;        Size of packet to transmit, including all headers.
  1152. Send out one packet.  This is generally not interrupt 
  1153. driven.  The packet size may be smaller than the minimum 
  1154. Ethernet packet size.  If so, this routine must take care of 
  1155. the details.  The frame to transmit always includes the 
  1156. entire Ethernet frame header, so non-802.3 drivers may need 
  1157. to strip the header to modify higher layer code.
  1158.  
  1159. etupdate()
  1160. Remove one packet from the buffer.  This routine is 
  1161. generally unmodified from driver to driver.  The incoming 
  1162. packet is not copied from the buffer until fully processed, 
  1163. so the driver must wait until etupdate() is called before 
  1164. freeing the space back to the buffer.
  1165.  
  1166.